import { _decorator, Component, Node } from 'cc';
import { BaseComponent } from '../Manager/UIManager/BaseComponent';
import { SOUND_TYPE } from '../Data/GlobalData';
const { ccclass, property } = _decorator;

@ccclass('PopAd')
export class PopAd extends BaseComponent {

    //复活方法
    public SaveCb: Function = null;

    //关闭方法
    public CloseCb: Function = null;

    protected OnShow(): void {

    }

    /**
     * 点击复活挑战
     */
    private SaveClick() {
        app.audioManager.PlayEffect(SOUND_TYPE.Button);

        app.adManager.ShowVideo(0, (_isend: boolean) => {
            if (_isend) {
                this.SaveCb && this.SaveCb();
                app.topManager.ShowPrompt("复活成功");
            } else {
                app.topManager.ShowPrompt("复活失败");
            }
        })


    }

    /**
     * 点击关闭
     */
    private CloseClick() {
        app.audioManager.PlayEffect(SOUND_TYPE.Button);
        this.CloseCb && this.CloseCb();
    }

}


